package com.swind.fast.modules.app.halali.common.constant.enums;

/**
 * 分类
 */
public enum OrderStatus {
    DRAFT(0, "Draft"),
    NEW(1, "New"),
    PREPARING(2, "Preparing"),
    // ACCEPTED(2, "Accepted"),
    // PREPARING(3, "Preparing"),
    // WAITINGFORDELIVERY(3, "WaitingforDelivery"),
    READY(3, "Ready"),
    COMPLETED(4, "Completed");
    int code;
    String title;
    OrderStatus(int code, String title) {
        this.code = code;
        this.title = title;
    }
    public int getCode() {
        return code;
    }
    public void setCode(int code) {
        this.code = code;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public static OrderStatus getOrderStatusByCode(Integer code) {
        for (OrderStatus e : OrderStatus.values()) {
            if (e.code == code) {
                return e;
            }
        }
        return null;
    }

    public static String getTitleByCode(Integer code) {
        for (OrderStatus e : OrderStatus.values()) {
            if (e.code == code) {
                return e.title;
            }
        }
        return "";
    }
}
